package com.ss.zsensm;

public class ZSOrientationXWidget extends ZSOrientationWidget {
	int idx;
	
	public ZSOrientationXWidget(MainActivity mainActivity) {
		super(mainActivity);
	}
	public int register(int id) {
		idx = id;
		return id + 4;
	}
	
	public void OnChange(float data) {
		int rdata = (int) data;
		mainActivity.OnDataChange(idx + 3, (byte) (rdata & 0xff));
		mainActivity.OnDataChange(idx + 2, (byte) ((rdata >> 8) & 0xff));
		mainActivity.OnDataChange(idx + 1, (byte) ((rdata >> 16) & 0xff));
		mainActivity.OnDataChange(idx, (byte) ((rdata >> 24) & 0xff));
	}
	@Override
	public void install() {
		mainActivity.registerOrientationListener();
	}
	@Override
	public void uninstall() {
		mainActivity.unRegisterOrientationListener();
	}
}
